TARGET		= cmc
#TARGET1		= xmltest

CFLAGS += 

LDFLAGS += -lcmsmdm -lpthread



HEADERS = $(wildcard ./*.h)

SOURCES = $(wildcard ./*.c)

OBJECTS = $(patsubst %.c, %.o, $(SOURCES))

TEST_OBJS = xmltest.o
UTIL_OBJS = cmc.o

all: $(TARGET) $(TARGET1)
	cp $(TARGET) $(TARGET1) $(CMS_LIB_DIR)
	cp start stop $(CMS_LIB_DIR)
	@echo "###################################"
	@echo "#        $(TARGET) $(TARGET1) "
	@echo "#        Build up successfully"
	@echo "###################################"		

$(TARGET): $(UTIL_OBJS)
	$(CC) $(CFLAGS) $^  -o $@ $(LDFLAGS)

$(TARGET1): $(TEST_OBJS)
	$(CC) $(CFLAGS) $^  -o $@ $(LDFLAGS)
	
.c.o:
	$(CC) $(CFLAGS) -c $< -o $@ 

clean:
	@echo "###################################"
	@echo "#        clean $(TARGET)  $(TARGET1) "
	@echo "###################################"		
	rm -f $(TARGET) $(TARGET1) $(OBJECTS)
	rm -f *.o *.d
